package mysql

import "gorm.io/gorm"

type Video struct {
	gorm.Model
	Name    string `gorm:"type:varchar(30);not null;comment:'用户名'"`
	Date    string `gorm:"type:varchar(100);not null; comment:'上传日期'"`
	Content string `gorm:"type:varchar(225);not null;comment:'视频简介'"`
	Status  int64  `gorm:"type:int;not null;comment:'视屏状态:1.上传成功,2.待审核,3.审核通过,4.审核失败'"`
}

func (v *Video) List(name string) (list []*Video, err error) {
	err = DB.Debug().Where("name =?", name).Find(&list).Error
	return
}

func (v *Video) Create() error {
	err := DB.Debug().Create(&v).Error
	return err
}

func (v *Video) Find() error {
	err := DB.Debug().Find(&v).Limit(10).Error
	return err
}
